/***  This .do file produces the following figures (Fig 3, 5, 6, A2, A3, A4, A5, A6, A7, A8, A9) ***/
/***  in "Self-Control and Demand for Preventive Health: Evidence from Hypertension in India".   ***/

clear
set more off

********************************************************************************
***********  Figure 3: Take-up and Clinic Visits by Treatment Group  ***********
********************************************************************************

use "....../BHMR_RESTAT_figures.dta"

# delimit;

keep if outcome == 1 | outcome == 2;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		text(-0.02 1 "N/A", size(large) place(s))
		text(0.105 2 "Proportion", size(large) place(n))
		text(0.08 2 "of visits", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		text(-0.02 1 "N/A", size(large) place(s))
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		text(0.18 1 "Take-up", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");


********************************************************************************
*********  Figure 5: Joint distribution of beta and beta-hat estimates  ********
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_beta_betahat.dta", clear;

twoway  kdensity beta, lcolor(gs1) lwidth(mediumthick)
		xlabel(none)
		xtick(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1)
		yscale(range(0 5)) ylabel(0 1 2 3 4 5)
		ytitle(Kernel Density `=ustrunescape("\u03B2")')
		xtitle("")
		graphregion(fcolor(white))
		saving(beta_density, replace)
		fysize(30);


twoway  kdensity betahat, 
	    xsca(reverse) ysca(alt) horiz 
		lcolor(gs1) lwidth(mediumthick) ||
		scatteri 0.6 0.9 0.6 0, recast(line)
		lcolor(gs1) lwidth(mediumthick) ||
		scatteri 0.6 0 0 0, recast(line)
		lcolor(gs1) lwidth(mediumthick)
		xscale(range(0 5)) xlabel(0 1 2 3 4 5)
		yscale(range(0 1)) ylabel(none)
		ytick(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1)
		ytitle("") legend(off)
		xtitle(Kernel Density `=ustrunescape("\u03B2\u0302")')
		graphregion(fcolor(white))
		saving(betahat_density, replace)
		fxsize(30);
		
twoway 	scatter betahat beta, mfcolor(gs1) mlcolor(gs1) ||
		line beta beta, lcolor(gs1)
		yscale(range(0 1)) ylabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1)
		ytitle(`=ustrunescape("\u03B2\u0302")')
		xtitle(`=ustrunescape("\u03B2")')
		xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1) 
		legend(off) graphregion(fcolor(white))
		saving(beta_betahat_scatter, replace); 

		
graph combine betahat_density.gph beta_betahat_scatter.gph beta_density.gph,
              hole(3) imargin(small) graphregion(fcolor(white));


********************************************************************************
**********  Figure 6: Consumer Welfare Impacts of Counterfactual CCs  **********
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_CounterfactualFig1.dta", clear;

twoway line d0 m, lcolor(gs5) || line d75 m, lcolor(gs5) lpattern(shortdash) ||
	   line d15 m, lcolor(gs5) lpattern(dash) || line d225 m, lcolor(gs5) lpattern(longdash) || 
	   line d30 m, lcolor(gs5) lpattern("_....")
	   ylabel(-5(5)10) xlabel(0(15)45) ytitle("Change in CW{sup:ND} vs. Control (Rupees)") 
	   legend(col(3) size(small)) yline(0, lcolor(gs15)) graphregion(fcolor(white))
	   saving(counterfactual_fig1, replace);

use "....../BHMR_RESTAT_CounterfactualFig2.dta", clear;

twoway line discountonly d, lcolor(gs5) || line m0 d, lcolor(gs5) lpattern(shortdash) || 
	   line m15 d, lcolor(gs5) lpattern(dash) || line m30 d, lcolor(gs5) lpattern(longdash) || 
	   line m45 d, lcolor(gs5) lpattern("_....")
	   ylabel(-10(5)10) xlabel(0(7.5)30) ytitle("Change in CW{sup:ND} vs. Control (Rupees)") 
	   legend(col(3) size(small)) yline(0, lcolor(gs15)) graphregion(fcolor(white))
	   saving(counterfactual_fig2, replace);
	

********************************************************************************
*********  Figure A.2: Personalized Commitment Contract Contributions  *********
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_commitment_amount.dta", clear;

graph bar nodiscount discount, over(amount) bar(1, color(black*0.8)) bar(2, color(grey*0.2))
           legend( label(1 "No Discount") label(2 "Discount") )
		   graphregion(fcolor(white))
           ytitle("Percent of Sample")
		   saving(commitment_amount, replace);
	
	
********************************************************************************
**********  Figure A.3: CC take-up and visits by treatment and gender  *********
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;

keep if outcome >= 11 & outcome <= 14;
replace outcome = outcome - 10;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(-0.02 1.5 "N/A", size(large) place(s))
		text(0.175 3.5 "Proportion", size(large) place(n))
		text(0.15 3.5 "of visits", size(large) place(n))
		text(0.1 3 "F", size(large) place(n))
		text(0.1 4 "M", size(large) place(s))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs16) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(-0.02 1.5 "N/A", size(large) place(s))
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(0.26 1.5 "Take-up", size(large) place(n))
		text(0.2 1 "F", size(large) place(n))
		text(0.215 2 "M", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(-0.05 0.55)) ylabel(0 0.1 0.2 0.3 0.4 0.5, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");

	
********************************************************************************
*********  Figure A.4: Post-Reminder Clinic Visits by Treatment Group  *********
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;

keep if outcome == 9 | outcome == 10;
replace outcome = outcome - 8;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		text(0.125 1 "Without", size(large) place(n))
		text(0.105 1 "Reminder", size(large) place(n))
		text(0.08 2 "With", size(large) place(n))
		text(0.06 2 "Reminder", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(-0.05 0.45)) ylabel(0 0.1 0.2 0.3 0.4, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 3)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");

********************************************************************************
******************  Figure A.5: Preventive Visits Over Time  *******************
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_visits_timing.dta", clear;	

* set survival time function;
stset adate_t, failure(firstvisit);
	
local ylab " 0 "0" .05 "5" .1 "10" .15 "15" ";
sts graph, cumhaz by(treatment) yla(`ylab', angle(0))  xline(166, lcolor(black))  
           xtitl("Days Since Baseline")    title("")                        
           ytitl("Percent of Sample with Clinic Visit")                     
           graphregion(color(white))                                        
           plot1opts(lpattern(solid) lcolor(black))                         
		   plot2opts(lpattern(dot) lcolor(black))                           
		   plot3opts(lpattern(shortdash) lcolor(black))                      
		   plot4opts(lpattern(dash) lcolor(black))                        
		   plot5opts(lpattern(longdash) lcolor(black))                     
		   plot6opts(lpattern("_....") lcolor(black))                  
		   text(.03 180 "Reminders", size(small) place(n))             
           text(.02 180 "Issued", size(small) place(n))              
		   legend(label(1 "Discount only") label(2 "Fixed CC, No Discount")  
           label(3 "Fixed CC, Discount") label(4 "Personalized CC, No Discount")
           label(5 "Personalized CC, Discount") label(6 "Control")  );	
	
	
********************************************************************************
*************  Figure A.6: Hypertension Status by Treatment Group  *************
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;

keep if outcome >= 15 & outcome <= 18;
replace outcome = outcome - 14;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(0.9 2.1 "Pre-hypertension", size(large) place(n))
		text(0.71 1 "BL", size(large) place(n))
		text(0.73 2 "EL", size(large) place(n))
		text(0.61 3.5 "Hypertension", size(large) place(n))
		text(0.4 3 "BL", size(large) place(n))
		text(0.4 4 "EL", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(0.2 1.0)) ylabel(0.2 0.4 0.6 0.8 1.0, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");
	
	
********************************************************************************
*****  Figure A.7: Baseline and Endline Blood Pressure by Treatment Group  *****
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;
	
keep if outcome == 3 | outcome == 4 | outcome == 7 | outcome == 8;
replace outcome = 1 if outcome == 7;
replace outcome = 2 if outcome == 3;
replace outcome = 3 if outcome == 8;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(148 1.5 "Systolic", size(large) place(n))
		text(136 1 "BL", size(large) place(n))
		text(132 2 "EL", size(large) place(n))
		text(90 3.5 "Diastolic", size(large) place(n))
		text(80 3 "BL", size(large) place(n))
		text(80 4 "EL", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(70 150)) ylabel(70 80 90 100 110 120 130 140, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");

	
********************************************************************************
****************  Figure A.8: Weight Status by Treatment Group  ****************
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;

keep if outcome >= 19 & outcome <= 22;
replace outcome = outcome - 18;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8)  
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		text(0.61 1.5 "Overweight", size(large) place(n))
		text(0.4 1 "BL", size(large) place(s))
		text(0.4 2 "EL", size(large) place(s))
		text(0.24 3.5 "Obesity", size(large) place(n))
		text(0.05 3 "BL", size(large) place(n))
		text(0.05 4 "EL", size(large) place(n))
		legend(off)
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==3,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==4,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)	
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(0 0.8)) ylabel(0 0.2 0.4 0.6 0.8, labcolor(white))
		yline(0, lcolor(gs10) lwidth(vvthin) lpattern(shortdash))
		xscale(range(0 5)) xlabel(none) xtitle("")
		legend(off)
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");

	
********************************************************************************
*******************  Figure A.9: Weight by Treatment Group  ********************
********************************************************************************

# delimit;

use "....../BHMR_RESTAT_figures.dta", clear;

keep if outcome == 5 | outcome == 6;
replace outcome = outcome - 4;

/* PANEL A: Control group */;

twoway 	rcap cntl_h cntl_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter cntl_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter cntl_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off)
		t1title("  ", size(large) margin(small))
		t2title({bf:A: Control}, size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70)  
		xscale(range(0 3)) xlabel(none) xtitle("")
		text(64 1 "Baseline", size(large) place(n))
		text(69.5 2 "Endline", size(large) place(n))
		graphregion(fcolor(white))
		saving(cntl, replace);	
		
/* PANEL B: Discount group */;

twoway 	rcap discnt_h discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off)
		t1title("  ", size(large) margin(small))
		t2title({bf:B: Discount}, size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70, labcolor(white))
		xscale(range(0 3)) xlabel(none) xtitle("")
		graphregion(fcolor(white))
		saving(discnt, replace);
	
/* PANEL C: Fixed CC group */;

twoway 	rcap fixcc_h fixcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off) 
		t1title("  ", size(large) margin(small))	
		t2title({bf:C: Fixed CC}, size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70, labcolor(white))
		xscale(range(0 3)) xlabel(none) xtitle("")
		graphregion(fcolor(white))
		saving(fixcc, replace);

/* PANEL D: Personalized CC group */;

twoway 	rcap flexcc_h flexcc_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off)
		t1title("  ", size(large) margin(small))
		t2title({bf:D: Personalized CC}, size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70, labcolor(white))
		xscale(range(0 3)) xlabel(none) xtitle("")
		graphregion(fcolor(white))
		saving(flexcc, replace);

/* PANEL E: Fixed CC + Discount group */;

twoway 	rcap fixcc_discnt_h fixcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter fixcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter fixcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off) 
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:E: Fixed CC,}", size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70, labcolor(white))
		xscale(range(0 3)) xlabel(none) xtitle("")
		graphregion(fcolor(white))
		saving(fixcc_discnt, replace);

/* PANEL F: Personalized CC + Discount group */;

twoway 	rcap flexcc_discnt_h flexcc_discnt_l outcome, lwidth(thick) lcolor(gs10) msize(vtiny) ||
		scatter flexcc_discnt_est outcome if outcome==1,
			msymbol(circle) msize(huge) mfcolor(gs1) mlcolor(gs10) ||
		scatter flexcc_discnt_est outcome if outcome==2,
			msymbol(circle) msize(huge) mfcolor(gs15) mlcolor(gs10)
		legend(off) 
		t1title("{bf:Discount}", size(large) margin(small))
		t2title("{bf:F: Personalized CC,}", size(large) margin(small))
		yscale(range(60 70)) ylabel(60 62 64 66 68 70, labcolor(white))
		xscale(range(0 3)) xlabel(none) xtitle("")
		graphregion(fcolor(white))
		saving(flexcc_discnt, replace);
		
		
graph combine cntl.gph discnt.gph fixcc.gph flexcc.gph fixcc_discnt.gph flexcc_discnt.gph, 
	ysize(8) xsize(17) row(1) col(6) 
	graphregion(fcolor(white))
	imargin(small)
	note("");
	
	
	
